package org.hong.monkey.crawl

import org.hong.monkey.Logging
import org.hong.monkey.util.{ThreadUtils, Utils}

import scala.concurrent.ExecutionContext

/**
 * Created by wangsihong on 2016/11/10.
 */
private[monkey] object HttpDownloaderManager extends Logging {

  val executor = ExecutionContext.fromExecutorService(
    ThreadUtils.newDaemonCachedThreadPool("HttpDownloader-future", 512))

  def createDownloaderByClass(className: String): HttpDownloader = {
    Utils.classForName(className)
      .getConstructor().newInstance().asInstanceOf[HttpDownloader]
  }

}
